<!--
 * @docName: infoManagementDetails.vue
 * @Author: mwl
 * @Date: 9:47
 * @LastEditors: mwl
 * @LastEditTime: 9:47
-->
<template>
  <div class='main_content'>
    <a-tabs default-active-key="1" v-model="activeKey" @change="callback">
      <a-tab-pane key="1">
        <span slot="tab">登录信息</span>
        <MessageInfo />
      </a-tab-pane>
      <a-tab-pane key="2">
        <span slot="tab">渠道信息</span>
        <ChannelMessage v-if="detailList.businessLicenseVo" :detailList="detailList.businessLicenseVo" :channelType="channelType" />
      </a-tab-pane>
      <a-tab-pane key="3">
        <span slot="tab">银行账户</span>
        <BankAccount :detailList="detailList.businessAccountVo" />
      </a-tab-pane>
      <a-tab-pane key="4">
        <span slot="tab">开票服务费</span>
        <InvoiceServiceFee :detailList="detailList.agreeInfoVo" :applicableEntNumObj="applicableEntNumObj" />
      </a-tab-pane>
      <a-tab-pane key="5">
        <span slot="tab">注册服务费</span>
        <RegisterServiceFee :detailList="detailList.channelServiceFeeVos" />
      </a-tab-pane>
      <a-tab-pane key="6" v-if="channelVerifyStatus">
        <span slot="tab">我的合同</span>
        <ChannelContractList />
      </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import { queryLoginChannel,queryApplicable } from '@/api/enterprise'
import MessageInfo from './modules/messageInfoNew'
import ChannelMessage from './modules/channelMessage'
import BankAccount from './modules/bankAccount'
import InvoiceServiceFee from './modules/invoiceServiceFee'
import RegisterServiceFee from './modules/registerServiceFee'
import ChannelContractList from './modules/channelContractList'
export default {
  name: 'infoManagementDetails',
  components: {
    MessageInfo,
    ChannelMessage,
    BankAccount,
    InvoiceServiceFee,
    RegisterServiceFee,
    ChannelContractList,
  },
  data(){
    return{
      activeKey:'1',
      timer:null,
      detailList: {},
      applicableEntNumObj: {},   //适用企业
      channelVerifyStatus: false
    }
  },
  created(){
    this.getChannelUserInfo();
  },
  mounted(){
    this.showtabs();//跳转到指定tab
  },
  methods:{
    callback(key) {
      //刷新子组件
      this.timer = new Date().getTime();
    },
    showtabs(){
      if (this.$route.query.pagetab){
        this.activeKey = this.$route.query.pagetab;
      }
    },
    //获取渠道信息
    getChannelUserInfo(){
      queryLoginChannel().then(res => {
        if (res.success) {
          let data = res.result;
          this.detailList = data;

          //渠道类型 1-企业渠道 2-个人渠道 3-直客
          if (data.channelInfoVo){
            this.fun(data.channelInfoVo.id);
            if (data.channelInfoVo.channelType == 1){
              this.channelType = true;
            }else {
              this.channelType = false;
            }

            //获取企业入驻状态
            //channelVerifyStatus  渠道状态：1同步导入 2待签约 3已签约
            if (data.channelInfoVo.channelVerifyStatus == 3){
              this.channelVerifyStatus = true;
            }else{
              this.channelVerifyStatus = false;
            }

          }
        } else {
          this.$message.warning(res.message);
        }
      })
    },
    //获取适用企业
    fun(id){
      let params = {};
      params.channelId = id;
      queryApplicable(params).then(res => {
        if (res.success) {
          this.applicableEntNumObj = res.result;

        } else {
          this.$message.warning(res.message);
        }
      })
    }
  }
}
</script>

<style scoped lang='less'>
.content{
  background: #fff;
}
</style>
